﻿using System;
using System.Collections.Generic;
using System.Text;
using DeepHash.Document;
using DeepHash.Document.Format;
using DeepHash.CommandParser;
using System.IO;

namespace DeepHash.Run
{
    class GenerateCommand : CommandBase
    {
        public GenerateCommand()
            : base("generate")
        {
        }

        private string _path = string.Empty;
        [CommandParameter("path")]
        public string Path
        {
            get { return _path; }
            set { _path = value; }
        }

        private string _output = string.Empty;
        [CommandParameter("output")]
        public string Output
        {
            get { return _output; }
            set { _output = value; }
        }

        public override void Execute()
        {
            DirectoryWalker walker = new DirectoryWalker();
            VerificationDocument doc = walker.WalkDirectory(this.Path, new MD5HashAlgorithem(),
                true, null);
            doc.SaveFile(this.Output, new TextDocumentFormatter());
        }
    }
}
